package com.cloud.rocketmq.listener;

import com.cloud.rocketmq.entity.User;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 普通消费者,单个接受
 */
@Component
@RocketMQMessageListener(topic = "rocketMqSimple", consumerGroup = "OneReceive") //topic要与生产者的topic一致
public class SimpleConsumer3 implements RocketMQListener<MessageExt> {
    // 报错就会重新消费，所以可以try catch
    @Override
    public void onMessage(MessageExt msg) {
        System.out.println("SimpleConsumer2接受到的信息为" + msg);
        // mq消息记录表中，添加一条记录
        // 如果出现异常，将消息状态修改，job重试
    }
}